<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<style type="text/css">
.dateWidth1{
   width:195px;
}
.select_width{
   width:130px;
}
</style>

<table class="t_css table01" width="100%" border="0" cellpadding="0" id="basicInfo1"
	cellspacing="1">
	<col style="width:18%"/>
	<col style="width:10%"/>
	<col style="width:22%"/>
	<col style="width:18%"/>
	<col style="width:16%"/>
	<col style="width:16%"/>
	<tr class="li_1">
		<td   colspan="6" class="t_bar2">${param.title}</td>
		
	</tr>
	<tr class="li_2">
		<td   align="right" ><span class="color_red">*</span>项目名称：</td>
		<td  colspan="5">
			<input id="zh_title" onchange="setZhTitle(this);" name="proposal/zh_title" label="${param.title}-->项目名称" type="text" required class="input_css required maxlength:100"  style="width:604px;" maxlength="100" value="<x:out select="$xmlData/data/proposal/zh_title" />"/> 
		</td>
	</tr>
	
	<tr class="li_1">
		<td   align="right" ><span class="color_red">*</span>项目类别：</td>
		<td colspan="5">
		 <label><input type="radio" name="project_type"  style="vertical-align: middle;"  class="do" value="1" label="基础研究"  onChange="setProjectType(this)"><span style="vertical-align: middle;">基础研究</span></label>&nbsp;&nbsp;&nbsp;&nbsp;
		 <label><input type="radio" name="project_type"  style="vertical-align: middle;"  class="do" value="2" label="应用研究"  onChange="setProjectType(this)"><span style="vertical-align: middle;">应用研究</span></label>&nbsp;&nbsp;&nbsp;&nbsp;
		 <label><input type="radio" name="project_type"  style="vertical-align: middle;"  class="do" value="3" label="试验发展"  onChange="setProjectType(this)"><span style="vertical-align: middle;">试验发展</span></label>&nbsp;&nbsp;&nbsp;&nbsp;
		 <label><input type="radio" name="project_type"  style="vertical-align: middle;"  class="do" value="4" label="研究与实验发展成果应用"  onchange="setProjectType(this)"><span style="vertical-align: middle;">研究与实验发展成果应用</span></label>
		<input type="hidden" id='project_type_value' name="proposal/project_type_value" class="required"  label="${param.title}-->项目类别"  value="<x:out select="$xmlData/data/proposal/project_type_value" />">	
		<input type="hidden" id="project_type_name"  name="proposal/project_type_name" value="<x:out select="$xmlData/data/proposal/project_type_name" />">	
		</td>
	</tr>
	<tr class="li_2">
		<td   align="right" rowspan="2"><span class="color_red">*</span>项目涉及学科：</td>
	  <td   align="right">代码1：</td>
	  <td><input id="subject3_value" label="${param.title}-->项目涉及学科-->代码1"
				type="text" class="gray" disabled="disabled" style="width: 78%;"
				maxlength="50" name="declarant/subject3_value"
				value="<x:out select="$xmlData/data/declarant/subject3_value" />" />
	  </td>
	  <td   align="right">学科名称1：</td>
	   <td colspan="2">
			<c:set var="subject3">{'id':'<x:out
						select="$xmlData/data/declarant/subject3_code" />','name':'<x:out
						select="$xmlData/data/declarant/subject3_name" />'}
		  </c:set>
			<cpt:tree key="medically" cacheable="false" readonly="true" value="${subject3}" id="subject3" name="declarant/subject3"  showPattern="all" shieldPattern="-1 " onClick="initTreeValuejsdtr"   label="项目涉及学科-->学科名称1" />
			<input type="hidden" id="subject3_code" name="declarant/subject3_code" value="<x:out select="$xmlData/data/declarant/subject3_code" />" class="required"  label="${param.title}-->项目涉及学科-->学科名称1"/> 
			<input type="hidden" id="subject3_name" name="declarant/subject3_name" value="<x:out select="$xmlData/data/declarant/subject3_name" />" />
			</td>
	</tr>
	
	<tr class="li_1">
	  <td   align="right">代码2：</td>
	  <td>
	      <input id="subject4_value" label="${param.title}-->项目涉及学科-->代码2"
				type="text" class="gray" disabled="disabled" style="width: 78%;"
				maxlength="50" name="declarant/subject4_value"
				value="<x:out select="$xmlData/data/declarant/subject4_value" />" />
	  </td>
	  <td   align="right">学科名称2：</td>
	   <td colspan="2">
			<c:set var="subject4">{'id':'<x:out
						select="$xmlData/data/declarant/subject4_code" />','name':'<x:out
						select="$xmlData/data/declarant/subject4_name" />'}
		  </c:set>
			<cpt:tree key="medically" cacheable="false" readonly="true" value="${subject4}" id="subject4" name="declarant/subject4"  showPattern="all" shieldPattern="-1 " onClick="initTreeValuejsdtr"   label="项目涉及学科-->学科名称2" />
			<input type="hidden" id="subject4_code" name="declarant/subject4_code" value="<x:out select="$xmlData/data/declarant/subject4_code" />" class="required"  label="${param.title}-->项目涉及学科-->学科名称2"/> 
			<input type="hidden" id="subject4_name" name="declarant/subject4_name" value="<x:out select="$xmlData/data/declarant/subject4_name" />" />
			</td>
	</tr>
	<tr>
			<td align="right"><span class="color_red">*</span>研究领域：</td>
			<td colspan="5"><c:set var="sub">
					<x:out select="$xmlData/data/proposal/sub_grant_code" />
				</c:set> 
			<%-- 	<c:if test="${sub=='3114' or sub=='3516' }">
				<c:set var="researcharea">{'id':'<x:out
						select="$xmlData/data/proposal/researcharea_value" />','name':'<x:out
						select="$xmlData/data/proposal/researcharea_name" />'}</c:set> 
						<cpt:tree
					key="researcharea1" cacheable="false" className="hn_iuput_kuang"
					readonly="true" value="${researcharea}" label="项目信息-->学科组" width="84.5%"
					id="researcharea" showPattern="current" shieldPattern="0" 
					topCheckbox="false" 
					onClick="initTreeValue3"
					sqlParamVal="{grant_code:${sub},stat_year:${param.statYear}}" />
					</c:if> --%>
					<%-- <c:if test="${sub=='3115' or sub=='3116'}"> --%>
					<c:set var="researcharea">{'id':'<x:out
						select="$xmlData/data/proposal/researcharea_value" />','name':'<x:out
						select="$xmlData/data/proposal/researcharea_name" />'}</c:set> 
					 <cpt:tree
					key="researcharea1" cacheable="false" className="hn_iuput_kuang"
					readonly="true" value="${researcharea}" label="${param.title}-->研究领域" width="20%"
					id="researcharea" showPattern="current" shieldPattern="0" 
					topCheckbox="false"  onClick="initTreeValue3"
					sqlParamVal="{grant_code:${sub},stat_year:${param.statYear}}" />
					<%-- </c:if> --%>
					<c:set var="subgrantcode">
					<x:out select="$xmlData/data/proposal/sub_grant_code" />
				</c:set> 
				
				<input id="researcharea_value" type="hidden" name="proposal/researcharea_value"
				 class="required" label="${param.title}-->研究领域"
				value="<x:out select="$xmlData/data/proposal/researcharea_value" />" /> <input
				id="researcharea_name" type="hidden" name="proposal/researcharea_name"
				value="<x:out select="$xmlData/data/proposal/researcharea_name" />" /></td>
				
		</tr>
		
	
	<tr class="li_2">
	<td  align="right" nowrap><span class="color_red">*</span>项目开始日期：</td>
		<td colspan="2">
			<c:set var="start_date"><x:out select="$xmlData/data/proposal/start_date" /></c:set>
			<cpt:date id="start_date" name="proposal/start_date" value="${start_date}" className="required date  dateCompare:end_date" label="${param.title}-->项目开始日期"    onChange="setStartDate()" onselected="function(){setStartDate();}"></cpt:date> 
		</td>
		<td  align="right" nowrap ><span class="color_red">*</span>项目结束日期：</td>
		<td colspan="2">
			<c:set var="end_date"><x:out select="$xmlData/data/proposal/end_date" /></c:set>
			<cpt:date id="end_date" name="proposal/end_date" className="required date" label="${param.title}-->项目结束日期"  value="${end_date}"  onChange="setEndDate()" onselected="function(){setEndDate();}"></cpt:date> 
		</td>
	</tr>
	<tr class="li_1">
	    <td  align="right" ><span class="color_red">*</span>申报日期：</td>
		<td colspan="2">
			<c:set var="submit_date"><x:out select="$xmlData/data/proposal/submit_date" /></c:set>
			<cpt:date id="submit_date" name="proposal/submit_date" value="${submit_date}" className=" required date" label="${param.title}-->申报日期"></cpt:date> 
		</td>
		 <td  align="right" >归口管理部门：</td>
		<td colspan="2">
			<x:out select="$xmlData/data/proposal/tjbm_org_name" />
		</td>
	</tr>
		<tr class="li_2">
	<td align="right">依托平台（重点实验&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>室、工程技术中心等）：</td>
	<td nowrap  colspan="2" valign="middle">
	<label> <input type="checkbox" class="do " id="advant_01" style="vertical-align: middle;" name="innovate2" label="国家级" value="01" /><span style="vertical-align: middle;">国家级</span></label>&nbsp; &nbsp; &nbsp;  
	<label> <input type="checkbox" class="do " id="advant_02" style="vertical-align: middle;" name="innovate2" label="省部级" value="02" /><span style="vertical-align: middle;">省部级</span></label>&nbsp; &nbsp; &nbsp; 
	<label> <input type="checkbox" class="do" id="advant_03" style="vertical-align: middle;" onclick="showText(this);" name="innovate2" label="其他" value="03" /><span style="vertical-align: middle;">其他</span></label>
    <input type="text" name="proposal/innovate2_other" id="innovate2_other"  class="input_css  maxlength:100" style="display:none;width:95px;"  maxlength="100" value="<x:out select="$xmlData/data/proposal/innovate2_other" />" label="${param.title}-->依托平台（重点实验室、工程技术中心等）-->其他" /> 
	
	<input type="hidden" name="proposal/innovate2_value" id="innovate2_value" class="" value="<x:out select="$xmlData/data/proposal/innovate2_value" />" label="${param.title}-->依托平台" /> 
	<input type="hidden" name="proposal/innovate2_name" id="innovate2_name" value="<x:out select="$xmlData/data/proposal/innovate2_name" />" label="${param.title}-->依托平台" /></td>
	<td align="right">所属创新团队：</td>
	<td nowrap  colspan="2" valign="middle">
	<label> <input type="checkbox" class="do " id="innovate_team_01" style="vertical-align: middle;" name="innovate_team" label="国家级" value="01" /><span style="vertical-align: middle;">国家级</span></label>&nbsp; &nbsp; &nbsp;  
	<label> <input type="checkbox" class="do " id="innovate_team_02" style="vertical-align: middle;" name="innovate_team" label="省部级" value="02" /><span style="vertical-align: middle;">省部级</span></label>&nbsp; &nbsp; &nbsp;  
	<label> <input type="checkbox" class="do " id="innovate_team_03" style="vertical-align: middle;" onclick="showText(this);" name="innovate_team" label="其他" value="03" /><span style="vertical-align: middle;">其他</span></label>
	<input type="text" name="proposal/innovate_team_other" id="innovate_team_other"  class="input_css  maxlength:100" style="display:none;width:95px;"  maxlength="100" value="<x:out select="$xmlData/data/proposal/innovate_team_other" />" label="${param.title}-->所属创新团队-->其他" /> 
	
	<input type="hidden" name="proposal/innovate_team_value" id="innovate_team_value" class="" value="<x:out select="$xmlData/data/proposal/innovate_team_value" />" label="${param.title}-->所属创新团队" /> 
	<input type="hidden" name="proposal/innovate_team_name" id="innovate_team_name" value="<x:out select="$xmlData/data/proposal/innovate_team_name" />" label="${param.title}-->所属创新团队" /></td>
	</tr>
	</table>
<script type="text/javascript">
  function setZhTitle(obj){
	  $("#zh_title_intro").text($(obj).val());
  }
  
  function setProjectType(obj){
	  $("#project_type_name_intro").text($("#"+$(obj).attr("name")+"_name").val()); 
  }
  
   function setStartDate(){
	  $("#start_date_intro").text($("#start_date").val());
  }
  
  function setEndDate(){
	  $("#end_date_intro").text($("#end_date").val());
  }
 
  
  
  
  function localInitTreeValue(treeId, treeNode) {
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		if (!(treeNode && (treeNode.level > 0 || !treeNode.isParent))) {
			scmWarn($("#" + treeId).attr("label")
					+ messageTip.researchAreaInvalidDisciplineCode);
			return false;
		}
		while (obj != null) {
			obj = obj.parentNode;
		}
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "sub_name'],[id$='" + treeId + "sub_name']").val(str.split("-")[0]);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "sub_value'],[id$='" + treeId + "sub_value']").val(treeNode.id.split("-")[0]);
		$("#" + treeId).parents("td").find("[name$='subject_no']").val(str.split("-")[1]);
		$("#" + treeId).parents("tr").find("[name$='researcharea_name']").text(treeNode.parentNode.name);
		$("#" + treeId).parents("tr").find("[name$='researcharea_value']").val(treeNode.parentNode.id);
		$("#" + treeId).val(str);
 }
  function showText(obj){
	 
	  if(($(obj).attr("checked")=="checked")){
		  $("#"+$(obj).attr("name")+"_other").css("display","");
		  $("#"+$(obj).attr("name")+"_other").addClass("required");
	  }else{
		  $("#"+$(obj).attr("name")+"_other").css("display","none");
		  $("#"+$(obj).attr("name")+"_other").val("");
		  $("#"+$(obj).attr("name")+"_other").removeClass("required");
	  }
  }
  $(document).ready(function(){
	  if($("#innovate2_value").val().indexOf("03")!=-1){
		  $("#innovate2_other").css("display","");
		  $("#innovate2_other").addClass("required");
	  }
	  if($("#innovate_team_value").val().indexOf("03")!=-1){
		  $("#innovate_team_other").css("display","");
		  $("#innovate_team_other").addClass("required");
	  }
	  
  });
  
  
  function initTreeValuejsdtr(treeId, treeNode) {
		
		if (!(treeNode && treeNode.level > 0 ) ) {
			scmWarn($("#" + treeId).attr("label")
					+ messageTip.researchAreaInvalidDisciplineCode);
			if (treeNode.level == 0) {
				$("#" + treeId).val("");
				$("#" + treeId).parents("td").find(
						"[name$='" + treeId + "_code'],[id$='" + treeId
								+ "_code']").val("");
				$("#" + treeId).parents("td").find(
						"[name$='" + treeId + "_name'],[id$='" + treeId
								+ "_name']").val("");
			}
			return false;
		}
		var oldval = $("#" + treeId).parents("td").find(
				"[name$='" + treeId + "_code'],[id$='" + treeId + "_code']")
				.val();
		var oldname = $("#" + treeId).parents("td").find(
				"[name$='" + treeId + "_name'],[id$='" + treeId + "_name']")
				.val();
		oldval = $.trim(oldval);
		oldname = $.trim(oldname);
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			str = obj.name + "-" + str;
			obj = obj.parentNode;
		}
		if (treeId == 'impl_area') {

			if (treeNode.checked) {
				if (oldname != '')
					oldname += ',';
				if (oldval != '')
					oldval += ',';
				if(oldval.indexOf(treeNode.id)==-1)
					$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val(oldval + treeNode.id);
				if(oldname.indexOf(str)==-1){
					$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val(oldname + str);
					$("#" + treeId).parents("td").find("[name='" + treeId + "'],[id='" + treeId + "']").val(oldname + str);
				}
			} else {
				$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val(("," + oldval).replace(',' + treeNode.id, '').substring(1));
				$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val(("," + oldname).replace("," + str, '').substring(1));
				$("#" + treeId).parents("td").find("[name='" + treeId + "'],[id='" + treeId + "']").val(("," + oldname).replace("," + str, '').substring(1));
			}
		} else {
			$("#" + treeId).parents("td")
					.find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val(treeNode.id);
			$("#" + treeId).parents("td")
					.find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val(str);
		}

		
		$("#" + treeId + "_value").val(treeNode.id);

	}
  
  function initTreeValue3(treeId, treeNode) {
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			//str = obj.name + "-" + str;
			obj = obj.parentNode;
		}
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
		$("#" + treeId).val(str);
		initTreeValue2CallBack();
	}
  
  

  
</script>
